import stockApi from '@/api/declaration/erp/stockApi'
import httpRequest from '@/config/axios/httpRequest'
import { StockCheckModel } from '@/models/erp/StockCheckModel'


// ERP 库存盘点单 API
export const StockCheckApi = {
  // 查询库存盘点单分页
  getStockCheckPage: async (params: any) => {
    return await httpRequest.get(stockApi.GetStockCheckPage, params)
  },

  // 查询库存盘点单详情
  getStockCheck: async (id: number) => {
    return await httpRequest.get(stockApi.GetStockCheck, {params:{id}})
  },

  // 新增库存盘点单
  createStockCheck: async (data: StockCheckModel) => {
    return await httpRequest.post(stockApi.CreateStockCheck, data)
  },

  // 修改库存盘点单
  updateStockCheck: async (data: StockCheckModel) => {
    return await httpRequest.put(stockApi.UpdateStockCheck, data)
  },

  // 更新库存盘点单的状态
  updateStockCheckStatus: async (id: number, status: number) => {
    return await httpRequest.put(stockApi.UpdateStockCheckStatus, { ID: id, Status: status })
  },

  // 删除库存盘点单
  deleteStockCheck: async (ids: number[]) => {
    return await httpRequest.delete(stockApi.DeleteStockCheck, { params: { ids: ids.join(',') } })
  },

  // 导出库存盘点单 Excel
  exportStockCheck: async (params) => {
    return await httpRequest.download(stockApi.ExportStockCheck, params)
  }
}
